package com.ushio.gougouwangguo.controller;

import com.ushio.commonmodule.pojo.result.Result;
import com.ushio.commonmodule.pojo.vo.UserSeasonEventVo;
import com.ushio.gougouwangguo.service.IUserSeasonEventService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 张文凯
 * @since 2025-09-23
 */
@RestController
@RequestMapping("/userSeasonEvent")
@Tag(name="UserSeasonEvent",description = "用户季节表")
public class UserSeasonEventController {

    @Autowired
    IUserSeasonEventService iUserSeasonEventService;

    @GetMapping
    public Result<UserSeasonEventVo> getSeasonEvent(@RequestParam("userId")Long userId){

        try{

            UserSeasonEventVo userSeasonEvent =  iUserSeasonEventService.getSeasonEvent(userId);
            return Result.success(userSeasonEvent);
        }catch (Exception e){
            e.printStackTrace();
            return Result.fail();
        }

    }

    @PostMapping("/the-change-of-seasons")
    public Result<UserSeasonEventVo> theChangeOfSeasons(){

        try{
              iUserSeasonEventService.theChangeOfSeasons();
            return Result.success();
        }catch (Exception e){
            e.printStackTrace();
            return Result.fail(e.getMessage());
        }

    }


}
